package edu.utn.tacs.grupouno.ui.client;

import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Widget;

import edu.utn.tacs.grupouno.ui.client.dto.TurnoDTO;

public class ChooseTurnoActionExecutor implements TurnoActionExecutor {

	private ClickHandlerFactory<TurnoDTO> handlerFactory;

	public ChooseTurnoActionExecutor(ClickHandlerFactory<TurnoDTO> handlerFactory) {
		this.handlerFactory = handlerFactory;
	}
	@Override
	public boolean canExecute(TurnoDTO turno) {
		return turno.isDisponible();
	}

	@Override
	public Widget getWidget(TurnoDTO turno) {
		return new Button("Seleccionar", handlerFactory.create(turno));
	}

}
